<!DOCTYPE html>
<html>
  <head>
    <title>homePage.html</title>
	
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <script type="text/javascript" src="js/provincelink.js"></script>
	<link rel="stylesheet" href="css/pubStyle.css"/>

<style type="text/css">
<!--
body {
	background-color:#F7F7F7;
	margin: 0px;
}
-->
</style>
<script type="text/javascript" src="js/cookie_util.js"></script>
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
<script type="text/javascript" src="js/sofa.js"></script>
<script type="text/javascript" src="js/travel.js"></script>
<script type="text/javascript">
    var acctId = getCookie("uid");
    var realName = getCookie("realName");
    if (acctId == null) {
        window.location.href = "index.html";
    }
    $(function(){
        $("#acctId").html(realName);
        logOut();//退出登录功能
        //获取游记列表
        getTravelList(1,"img/news.gif","no");
        //获取沙发的列表
         $.ajax({
            url:"/SofaGuest/sofa/qrySofaList.do",
            type:"post",
            dataType:"json",
            success:function(result){
                //alert(result.detial);
                if("0000"==result.status){
                    var sofaInfo = result.data;
                    for(var i=0;i<sofaInfo.length;i++){
                        var sofa = sofaInfo[i];
                        var tr = '<tr><td width="3%"><img src="img/news.gif"/></td>'+
                                 '<td><a href="Javascript:void(0)" class="newstitle" onclick="getSofaDetial(this)">'+
                                 '[我有沙发] '+sofa.sofa_title+'</a></td><td width=140px;><span class="author">'+sofa.use_sex+'</span></td>'+
                                 '<td width=100px;><span class="ctime">'+sofa.sofa_type+'</span></td>'+
                                 '</tr>';
                        /*var tr = '<tr><td><img src="img/news.gif"/></td>'+
                                 '<td><a href="Javascript:void(0)" class="newstitle" onclick="getSofaDetial(this)">'+
                                 '[我有沙发] '+sofa.sofa_title+'</a></td></tr>';*/
                        var $tr = $(tr);
                        $tr.data("sofaId",sofa.sofa_id);
                        $("#sofaList").append($tr);
                    }
                }
            }
        });
        
        //查找沙发功能
        $("#b_qrysofa").click(function(){
            var province = $("#Select1").val().trim();
            var city = $("#Select2").val().trim();
            var distrct = $("#Select3").val().trim();
            var address = province+"-"+city+"-"+distrct;
            var sex = $("#sex").val().trim();
            var minAge = $("#minage").val().trim();
            var maxAge = $("#maxage").val().trim();
            var pernum = $("#pernum").val().trim();
            
            if(minAge == "" || minAge == null){
                minAge = "0";
            }
            if(maxAge == "" || maxAge == null){
                maxAge = "99";
            }
            if(pernum == "" ||pernum == null){
                pernum="1";
            }
            
            addCookie("address", address, 1);
            addCookie("sex", sex, 1);
            addCookie("minAge", minAge, 1);
            addCookie("maxAge", maxAge, 1);
            addCookie("pernum", pernum, 1);
            addCookie("qryTag",0,1);
            window.location.href="qrySofa.html";
        });
    });
    
    function getSofaDetial(a){
        $a = $(a);
        var sofaId = $a.parent().parent().data("sofaId");
        //alert(sofaId);
        addCookie("qrySofaDetialSofaId",sofaId,2);
        window.location.href="sofaDetail.html";
    }
</script>
</head>

<body class="firstpage">
	<div class="top">
		<div class="top-page">
			<div id="nav-title">
				<a href="homePage.html" class="title">首页</a>
            	<a href="Javascript:void(0)" class="title" onclick="gotoqrySofaHtml()">找沙发</a>
            	<a href="addSofa.html" class="title">我有沙发</a>
            	<a href="travelList.html" class="title">分享沙旅</a>
            	<a href="personMan.html" class="title">个人管理</a>
			</div>
			<div id="loginfo">
				<span>当前登陆：</span>
				<span id="acctId"></span>
				<span><a href="Javascript:void(0)" id="safeout"  target="_self">安全退出</a></span>
			</div>
		</div>
	</div>
	<div class="main-page">
		<div class="main-content">
			<div class="main-left">
				<div class="left-qry">
					<div class="qrySofaimg">
						<span>&nbsp;&nbsp;查找沙发</span>
					</div>
						<br/><br/>
						&nbsp;&nbsp;<span>目的地：</span><br/>
						&nbsp;&nbsp;&nbsp;<span>省份：</span><select id="Select1" class="selSty"></select><br/>
						&nbsp;&nbsp;&nbsp;<span>地市：</span><select id="Select2" class="selSty"></select><br/>
						&nbsp;&nbsp;&nbsp;<span>区县：</span><select id="Select3" class="selSty"></select><br/>
						<script type="text/javascript">
							addressInit('Select1', 'Select2', 'Select3');
						</script>
						<br/>
						&nbsp;&nbsp;<span>性别：</span>
						<select id="sex" class="selSty">
							<option value="1">不限</option>
                            <option value="2">男</option>
                            <option value="3">女</option>
						</select>
						<br/><br/>
						&nbsp;&nbsp;<span>年龄：</span>
						<input id="minage" class="inSty"/><span>岁</span><span>~</span><input id="maxage" class="inSty"/><span>岁</span>
						<br/><br/>
						&nbsp;&nbsp;<span>人数：</span>
						<input id="pernum" class="inSty"/><span>人</span>
						<br/><br/>
						<button type="submit" id="b_qrysofa">查找沙发</button>
				</div>
				<div class="left-ad">
					<div id="addsofa">
						<a href="addSofa.html"><img src="img/addmore.jpg" height="100%" width="100%"/></a>
					</div>
					<div id="hostRegiet">
						<a href="register.html"><img src="img/hostres.jpg" height="100%" width="100%"/></a>
					</div>
				</div>
			</div>
			<div class="main-right">
				<div class="main-top">
					<div class="qrySofaimg">
						<span>&nbsp;&nbsp;我有沙发</span>
							<div class="news">
								<table class="sofanews" id="sofaList">
									<!-- <tr>
										<td><img src="img/news.gif"/></td>
										<td><a href="" class="newstitle">[我有沙发]我是测试沙发沙发沙发。。。。</a></td>
									</tr>
									<tr>
										<td><img src="img/news.gif"/></td>
										<td><a href="" class="newstitle">[我有沙发]我是测试沙发沙发沙发。。。。</a></td>
									</tr> -->
								</table>
							</div>
					</div>
				</div>
				<div class="main-under">
					<div class="qrySofaimg">
						<span>&nbsp;&nbsp;我的沙旅</span>
							<div class="news">
								<table class="sofanews" id="travelList">
									<!-- <tr>
										<td width="3%"><img src="img/news.gif"/></td>
										<td width="80%"><a href="" class="newstitle">[我的沙旅]我是测试沙发沙发沙发。。。。</a></td>
										<td width=7%;><span class="author">崔健</span></td>
										<td width=10%;><span class="ctime">2017-04-16</span></td>
									</tr>
									<tr>
										<td><img src="img/news.gif"/></td>
										<td><a href="" class="newstitle">[我的沙旅]我是测试沙发沙发沙发。。。。</a></td>
									</tr> -->
								</table>
							</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="feet">
		<a href="homePage.html">首页</a><span>|</span>
		<a href="addSofa.html">新增沙发</a><span>|</span>
		<a href="register.html">入驻沙主</a><span>|</span>
		<a href="personMan.html">信息管理</a><span>|</span>
		<a href="adminman.html">后台管理</a><span>|</span>
		<a href="index.html">退出登录</a>
	</div>
</body>
</html>
